Pen : MariaDB Load Balancing
2016/01/11 |
Configure Pen to Load Balance to 2 MariaDB backends.
| -------+----------------------------------------------- | +-------------------+--------------------+ |10.0.0.30 |10.0.0.51 |10.0.0.52 +-----+------+ +-------+------+ +-------+------+ | Frontend | | Backend#1 | | Backend#2 | | Pen Server | | MariaDB | | MariaDB | +------------+ +--------------+ +--------------+ |
[1] | Configure Pen. Before this section, configure basic settings, refer to here. |
root@dlp:~#
vi /etc/pen.conf # create new
LOGFILE=/var/log/pen.log
WEBFILE=/var/www/html/pen/webstats.html MAX_CONNECTIONS=256 ROUNDROBIN=true # listening port PORT=3306 # number of backends BACKEND=2 # define backend servers SERVER1=10.0.0.51:3306 SERVER2=10.0.0.52:3306 /etc/init.d/pend restart |
[2] | Make sure it works fine to access to the frontend server from a Client with SQL like follows. |
root@desktop:~# mysql -u keystone -p -h 10.0.0.30 keystone -e "select * from table01;" Enter password: +------+-------------------+ | id | name | +------+-------------------+ | 1 | db01.srv.world | +------+-------------------+root@desktop:~# mysql -u keystone -p -h 10.0.0.30 keystone -e "select * from table01;" Enter password: +------+-------------------+ | id | name | +------+-------------------+ | 1 | db02.srv.world | +------+-------------------+ |